package com.example.xd.model_cache;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.xd.commen.annotation.FloatAnn;
import com.example.xd.commen.annotation.FloatProcess;
import com.example.xd.commen.annotation.Privilege;
import com.example.xd.commen.bean.TestBean;

import java.util.ArrayList;

@Route(path = "/model_cache/CacheActivity")
@Privilege(value = {Manifest.permission.WRITE_CALENDAR, Manifest.permission.READ_CALENDAR})
public class CacheActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cache_activity_main);
        ARouter.getInstance().inject(this);
        Intent intent = getIntent();
        String text = intent.getStringExtra("text");
        TextView tv = findViewById(R.id.tv);
        tv.setText("我是从：" + text + "来的");
        ArrayList<TestBean> testBeans = new ArrayList<>();
        testBeans.add(new TestBean("xdd", 18));
        testBeans.add(new TestBean("ws", 18));
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance()
                        .build("/model_net/NetActivity")
                        .withString("text", "cacheActivity")
                        .withSerializable("bean", new TestBean("xd", 18))
                        .withSerializable("list", testBeans)
                        .navigation();
            }
        });

    }
}
